Search for data programmatically using keywords or datasets’ concept_id
Access data using the earthaccess python library
Visualize sea level rise trends from altimetry datasets and compare against historic records
Requirements
1. Compute environment
This notebook can run anywhere thanks to earthaccess!
2. Earthdata Login
An Earthdata Login account is required to access data, as well as discover restricted data, from the NASA Earthdata system. Thus, to access NASA data, you need Earthdata Login. Please visit https://urs.earthdata.nasa.gov to register and manage your Earthdata Login account. This account is free to create and only takes a moment to set up.
Import (or Install) Packages
import logginglogging.basicConfig(level=logging.INFO, force =True)try:import earthaccessimport xarray as xrfrom pyproj import Geodimport numpy as npimport hvplot.xarrayfrom matplotlib import pyplot as pltfrom pprint import pprintimport panel as pnimport panel.widgets as pnwexceptImportErroras e: logging.warning("installing missing dependencies... ")%pip install -q earthaccess matplotlib hvplot pyproj xarray numpy h5netcdf panelfinally:import earthaccessimport xarray as xrfrom pyproj import Geodimport numpy as npimport hvplot.xarrayfrom matplotlib import pyplot as pltfrom pprint import pprintimport panel.widgets as pnw logging.info("Dependencies imported")
INFO:root:Dependencies imported
earthaccess and NASA’s EDL
We recommend authenticating your Earthdata Login (EDL) information using the earthaccess python package as follows:
auth = earthaccess.login()
Search for Sea Surface Height Data
Let’s find the first four collections that match a keyword search for Sea Surface Height and print out the first two.
Datasets found: 245
{'cloud-info': {'Region': 'us-west-2',
'S3BucketAndObjectPrefixNames': ['podaac-ops-cumulus-public/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/',
'podaac-ops-cumulus-protected/SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205/'],
'S3CredentialsAPIDocumentationURL': 'https://archive.podaac.earthdata.nasa.gov/s3credentialsREADME',
'S3CredentialsAPIEndpoint': 'https://archive.podaac.earthdata.nasa.gov/s3credentials'},
'concept-id': 'C2270392799-POCLOUD',
'file-type': "[{'Format': 'netCDF-4', 'FormatType': 'Native', "
"'AverageFileSize': 9.7, 'AverageFileSizeUnit': 'MB'}]",
'get-data': ['https://cmr.earthdata.nasa.gov/virtual-directory/collections/C2270392799-POCLOUD',
'https://search.earthdata.nasa.gov/search/granules?p=C2270392799-POCLOUD'],
'short-name': 'SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205',
'version': '2205'}
None This dataset provides gridded Sea Surface Height Anomalies (SSHA) above a mean sea surface, on a 1/6th degree grid every 5 days. It contains the fully corrected heights, with a delay of up to 3 months. The gridded data are derived from the along-track SSHA data of TOPEX/Poseidon, Jason-1, Jason-2, Jason-3 and Jason-CS (Sentinel-6) as reference data from the level 2 along-track data found at https://podaac.jpl.nasa.gov/dataset/MERGED_TP_J1_OSTM_OST_CYCLES_V51, plus ERS-1, ERS-2, Envisat, SARAL-AltiKa, CryoSat-2, Sentinel-3A, Sentinel-3B, depending on the date, from the RADS database. The date given in the grid files is the center of the 5-day window. The grids were produced from altimeter data using Kriging interpolation, which gives best linear prediction based upon prior knowledge of covariance.
{'DOI': '10.5067/SLREF-CDRV3', 'Authority': 'https://doi.org'}
{'cloud-info': {'Region': 'us-west-2',
'S3BucketAndObjectPrefixNames': ['podaac-ops-cumulus-protected/ALTIKA_SARAL_L2_OST_XOGDR/',
'podaac-ops-cumulus-public/ALTIKA_SARAL_L2_OST_XOGDR/'],
'S3CredentialsAPIDocumentationURL': 'https://archive.podaac.earthdata.nasa.gov/s3credentialsREADME',
'S3CredentialsAPIEndpoint': 'https://archive.podaac.earthdata.nasa.gov/s3credentials'},
'concept-id': 'C2251465126-POCLOUD',
'file-type': "[{'Format': 'netCDF-4', 'FormatType': 'Native'}]",
'get-data': ['https://search.earthdata.nasa.gov/search/granules?p=C2251465126-POCLOUD',
'https://cmr.earthdata.nasa.gov/virtual-directory/collections/C2251465126-POCLOUD'],
'short-name': 'ALTIKA_SARAL_L2_OST_XOGDR',
'version': 'f'}
None These data are near-real-time (NRT) (within 7-9 hours of measurement) sea surface height anomalies (SSHA) from the AltiKa altimeter onboard the Satellite with ARgos and ALtiKa (SARAL). SARAL is a French(CNES)/Indian(SARAL) collaborative mission to measure sea surface height using the Ka-band AltiKa altimeter and was launched February 25, 2013. The major difference between these data and the Operational Geophysical Data Record (OGDR) data produced by the project is that the orbit from SARAL has been adjusted using SSHA differences with those from the OSTM/Jason-2 GPS-OGDR-SSHA product at inter-satellite crossover locations. This produces a more accurate NRT orbit altitude for SARAL with accuracy of 1.5 cm (RMS), taking advantage of the 1 cm (radial RMS) accuracy of the GPS-based orbit used for the OSTM/Jason-2 GPS-OGDR-SSHA product. This dataset also contains all data from the project (reduced) OGDR, and improved altimeter wind speeds and sea state bias correction. More information on the SARAL mission can be found at: http://www.aviso.oceanobs.com/en/missions/current-missions/saral.html
{'DOI': '10.5067/AKASA-XOGD1', 'Authority': 'https://doi.org'}
Access Data
The first dataset looks like it contains data from many altimetry missions, let’s explore a bit more! We will access the first granule of the SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205 collection in the month of May for every year that data is available and open the granules via xarray.
granules = []for year inrange(1990, 2020):print(f"Searching for data in {year}") granule = earthaccess.search_data(doi="10.5067/SLREF-CDRV3", temporal= (f"{year}-05", f"{year}-06"), count =1)iflen(granule)>0: granules.append(granule[0])print(f"Total granules: {len(granules)}")
Searching for data in 1990
Granules found: 0
Searching for data in 1991
Granules found: 0
Searching for data in 1992
Granules found: 0
Searching for data in 1993
Granules found: 6
Searching for data in 1994
Granules found: 6
Searching for data in 1995
Granules found: 6
Searching for data in 1996
Granules found: 7
Searching for data in 1997
Granules found: 7
Searching for data in 1998
Granules found: 7
Searching for data in 1999
Granules found: 7
Searching for data in 2000
Granules found: 7
Searching for data in 2001
Granules found: 7
Searching for data in 2002
Granules found: 7
Searching for data in 2003
Granules found: 7
Searching for data in 2004
Granules found: 6
Searching for data in 2005
Granules found: 6
Searching for data in 2006
Granules found: 6
Searching for data in 2007
Granules found: 6
Searching for data in 2008
Granules found: 6
Searching for data in 2009
Granules found: 6
Searching for data in 2010
Granules found: 6
Searching for data in 2011
Granules found: 6
Searching for data in 2012
Granules found: 6
Searching for data in 2013
Granules found: 6
Searching for data in 2014
Granules found: 6
Searching for data in 2015
Granules found: 6
Searching for data in 2016
Granules found: 7
Searching for data in 2017
Granules found: 7
Searching for data in 2018
Granules found: 7
Searching for data in 2019
Granules found: 7
Total granules: 27